package com.xyoto.takeawayUser.controller;

import com.xyoto.takeawayUser.aspect.annotation.RequiresLogin;
import com.xyoto.takeawayUser.dto.SaveCarouselDto;
import com.xyoto.takeawayUser.service.CarouselService;
import com.xyoto.takeawayUser.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: 轮播图模块
 * @Author: 挽风
 * @Date: 2022
 * @Copyright: 2022 by 挽风
 * @Description:
 **/

@RestController
@RequestMapping("/carousel")
@Api(tags = "轮播图模块")
public class CarouselController {
    
    @Autowired
    private CarouselService carouselService;

    @PostMapping("/saveCarousel")
    @ApiOperation(value = "新增轮播图", notes = "新增轮播图")
    @RequiresLogin
    public Result addCarousel(SaveCarouselDto saveDto){
        return carouselService.saveCarousel(saveDto);
    }

    @GetMapping("/getCarouselAll")
    @ApiOperation(value = "获取所有轮播图", notes = "查询所有轮播图列表")
    public Result getCarouselAll(){
        return carouselService.getCarouselAll();
    }
}
